/*
visqrt
Copyright (C) 2010  Bhupendra Aole

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
*/
/*
 * File: VQThread.java
 * Author: Bhupendra Aole
 * Date: Sep 6, 2010: 
 * 
 * Revisions:
 * ----------
 */

package aole.renderer;

import javax.swing.JPanel;

/**
 * 
 */
public class VQThread extends Thread {
	private JPanel canvas;
	private boolean run;
	public int cury, width, lasty;

	public VQThread(JPanel c) {
		canvas = c;
		setPriority(MAX_PRIORITY);
	}

	@Override
	public void run () {
		run = true;
		lasty = 0;
		while (run) {
			canvas.paintImmediately(0, lasty, width, (cury - lasty) + 1);
			lasty = cury;
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public void stopThread () {
		run = false;
	}
}
